- 
                Notifications
    You must be signed in to change notification settings 
- Fork 117
Add opcache instrumentation #440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add opcache instrumentation #440
Conversation
e3d01c3    to
    bfdb728      
    Compare
  
    | Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@            Coverage Diff            @@
##               main     #440   +/-   ##
=========================================
  Coverage     81.90%   81.90%           
  Complexity     1988     1988           
=========================================
  Files           137      137           
  Lines          8096     8096           
=========================================
  Hits           6631     6631           
  Misses         1465     1465           Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry. 
 🚀 New features to boost your workflow:
 | 
7568b33    to
    d4b484e      
    Compare
  
    45eb208    to
    8bb376b      
    Compare
  
    | @brettmc , GitHub actions is not triggering CI for Opcache project , However I am able to run it locally.  | 
| } | ||
|  | ||
| if (extension_loaded('opentelemetry') === false) { | ||
| trigger_error('The opentelemetry extension must be loaded in order to autoload the OpenTelemetry IO auto-instrumentation', E_USER_WARNING); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| trigger_error('The opentelemetry extension must be loaded in order to autoload the OpenTelemetry IO auto-instrumentation', E_USER_WARNING); | |
| trigger_error('The opentelemetry extension must be loaded in order to autoload the OpenTelemetry opcache auto-instrumentation', E_USER_WARNING); | 
|  | ||
| // Register our own shutdown function to capture OPcache metrics | ||
| // register_shutdown_function([self::class, 'captureMetricsOnShutdown']); | ||
| register_shutdown_function('OpenTelemetry\Contrib\Instrumentation\opcache\opcacheInstrumentation::addOpcacheMetricsToRootSpan'); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this actually work? there's no guarantee that there is an active span during shutdown (I feel it's likely that there is not one), and also if there was an active span there's no guarantee that it's the root span. We do have an API method that would help, LocalRootSpan::current() however I think you need to re-think when this runs.
Perhaps a completely different approach where it emits metrics rather than attaching metric-like values to a span? You could do it with async/observable instruments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brettmc , yeah I think you are right.  we can take this up as a completely different way it emits metrics than span attributes.
I'll rework on this PR.
Thanks for the suggestion.
| php-version: 8.1 | ||
| - project: 'Instrumentation/PostgreSql' | ||
| php-version: 8.1 | ||
| - project: 'Instrumentation/Opcache' | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line excludes all versions. Since you're not actually hooking methods, you can just remove this line since it should work against 8.1
| - project: 'Instrumentation/Opcache' | 
This PR adds opcache instrumentation.